<?php

namespace app\common\business;

use app\common\mysql\Users as usersMysql;
use \think\Request;

class System extends \app\common\behavior\AbstractModel {

    /**
     * 更新版本
     *
     * */
    public static function update($update) {
        $data['sysupdate'] = json_encode($update);
        $data = usersMysql::name('system')
                ->where("id=1")
                ->update($data);
        return $data;
    }

    /**
     * 更新信息
     *
     * */
    public static function updatename($content, $name) {
        $update[$name] = $content;
        $data = usersMysql::name('system')
                ->where(array("id" => 1))
                ->update($update);
        return $data;
    }

    /**
     * 更新版本
     *
     * */
    public static function info($id) {
        $data = usersMysql::name('system')
                ->find($id);
        if ($data) {
            $data->sysupdate = json_decode($data->sysupdate, true);
        }
        return $data;
    }

}
